﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Stock.aspx.cs" Inherits="Stock_Stock"  MasterPageFile="../MasterPage.master" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="Common" %>
<%@ Import Namespace="DAL" %>

<%@ Register src="../common/Pager.ascx" tagname="Pager" tagprefix="uc2" %>

<%@ Register src="Stock_Left.ascx" tagname="Stock_Left" tagprefix="uc3" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table cellpadding="0" cellspacing="2" width="100%" border="0">
	<tr>
        <td class="leftTd"  valign="top" width="20%">
            <uc3:Stock_Left ID="Stock_Left1" runat="server" />
        </td>
		<td width="80%" valign="top">
		<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center">
			<tr>
		        <td class="leftTd"  valign="top">
		        <table cellpadding="0" cellspacing="0" width="100%" border="0" align="center">
		        	<tr>
		            	<td class="titleStyle"><%= WebUtility.GetTitleByMenu(MenuType) %></td>
		            </tr>
		        </table>
		         <br />
		          <table width="98%" border="0" cellpadding="0" cellspacing="1" align="center" bgcolor="#000066">
	                <tr>
		                <td style="height: 30px;" class="banma22_1">&nbsp;品名：<asp:TextBox ID="StName" 
                                runat="server" Width="60px" CssClass="face"></asp:TextBox>&nbsp;&nbsp;关键字：<asp:TextBox ID="Keyword" runat="server" Width="60px" CssClass="face"></asp:TextBox>&nbsp;&nbsp;
	                        <asp:TextBox ID="OneDate" runat="server" Width="70px" CssClass="face" Text="选择开始日期"></asp:TextBox>
	                        &nbsp;&nbsp;<asp:TextBox ID="TwoDate" runat="server" Width="70px" CssClass="face" Text="选择结束日期"></asp:TextBox>&nbsp;&nbsp;
                            <asp:Button ID="submit" runat="server" Text=" 搜 索 " CssClass="button" 
                                onclick="submit_Click" />&nbsp;&nbsp;
                            <asp:Button ID="submit0" runat="server" Text=" 导 出 " CssClass="button" 
                                onclick="submit0_Click" />
		                </td>
	                </tr>
                    </table><br/>
                    <asp:ListView ID="lv_Stock" runat="server" ondatabound="lv_Stock_DataBound" 
                        onitemediting="lv_Stock_ItemEditing" 
                        onitemdeleting="lv_Stock_ItemDeleting" DataKeyNames="StockKey" 
                        onitemcanceling="lv_Stock_ItemCanceling" 
                        onitemupdating="lv_Stock_ItemUpdating" >
                       <LayoutTemplate>
                            <table id="table1"  runat="server" width="98%" border="0" cellpadding="0" cellspacing="1" align="center" bgcolor="#000066">
                              <tr>
                                <td style="height: 25px; width: 5%;" class="banma1 TextCenters">序号</td>
                                <td style="height: 25px; width: 10%;" class="banma1 TextCenters">品名</td>
                                <td style="height: 25px; width: 15%;" class="banma1 TextCenters">规格</td>
		                        <td style="height: 25px; width: 10%;" class="banma1 TextCenters">单价</td>
		                        <td style="height: 25px; width: 8%;" class="banma1 TextCenters">数量</td>
		                        <td style="width: 12%;" class="banma1 TextCenters">建立时间</td>
		                        <td style="width: 10%;" class="banma1 TextCenters">建立人</td>
 	                            <td style="width: 10%;" class="banma1 TextCenters">操作</td>
	                          </tr>
                              <tr id="itemPlaceholder" runat="server" ></tr><br />
                            </table>
                       </LayoutTemplate>
                       <ItemTemplate>
                           <tr>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Container.DataItemIndex+1 %></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("StName")%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("StSpec")%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("Price")%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("Num")%></td>
		                    <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("CreateTime")%></td>
		                    <td class="banma22_2" style="height: 25px; text-align: center;"><%# new Account().GetAccountName(Eval("UserKey")) %></td>
	                        <td class="banma22_2" style="height: 25px; text-align: center;">
	                        <asp:LinkButton ID="Edit" runat="server" CommandName="edit" >修改</asp:LinkButton>
	                        <asp:LinkButton ID="Delete" runat="server" CommandName="delete"  OnClientClick="return confirm('确认要删除吗？');">删除</asp:LinkButton>
	                        </td>
	                       </tr> 
                      </ItemTemplate>
                       <AlternatingItemTemplate>
                           <tr>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Container.DataItemIndex+1 %></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("StName")%></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("StSpec")%></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("Price")%></td>
                            <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("Num")%></td>
		                    <td class="banma22_1" style="height: 25px; text-align: center;"><%# Eval("CreateTime")%></td>
		                    <td class="banma22_1" style="height: 25px; text-align: center;"><%# new Account().GetAccountName(Eval("UserKey")) %></td>
	                        <td class="banma22_1" style="height: 25px; text-align: center;">
	                        <asp:LinkButton ID="Edit" runat="server" CommandName="edit" >修改</asp:LinkButton>
	                        <asp:LinkButton ID="Delete" runat="server" CommandName="delete"  OnClientClick="return confirm('确认要删除吗？');">删除</asp:LinkButton>
	                        </td>
	                       </tr> 
                      </AlternatingItemTemplate>
                       <EditItemTemplate>
                           <tr>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Container.DataItemIndex+1 %></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;">
                                <asp:TextBox ID="txt_StName" runat="server" Text='<%# Eval("StName") %>' CssClass="input3" Width="100px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" 
                                    runat="server" ControlToValidate="txt_StName" ErrorMessage="请填写品名" Display="Dynamic"></asp:RequiredFieldValidator>
                            </td>
                            <td class="banma22_2" style="height: 25px; text-align: center;">
                                <asp:TextBox ID="txt_StSpec" runat="server" Text='<%# Eval("StSpec") %>' CssClass="input3" Width="100px"></asp:TextBox>
                            </td>
                            <td class="banma22_2" style="height: 25px; text-align: center;">
                                <asp:TextBox ID="txt_Price" runat="server" Text='<%# Eval("Price") %>' CssClass="input3" Width="60px"></asp:TextBox>
                                <asp:CompareValidator ID="CompareValidator2" runat="server" 
                                    ControlToValidate="txt_Price" ErrorMessage="单价是大于0的数字" Operator="GreaterThan" 
                                    Type="Currency" ValueToCompare="0" Display="Dynamic"></asp:CompareValidator>
                            </td>
                            <td class="banma22_2" style="height: 25px; text-align: center;">
                                 <asp:TextBox ID="txt_Num" runat="server" Text='<%# Eval("Num") %>' CssClass="input3" Width="60px"></asp:TextBox>
                                 <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                    ControlToValidate="txt_Num" ErrorMessage="数量是大于0的数字" Operator="GreaterThan" 
                                    Type="Currency" ValueToCompare="0" Display="Dynamic"></asp:CompareValidator>
                            </td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# Eval("CreateTime")%></td>
                            <td class="banma22_2" style="height: 25px; text-align: center;"><%# new Account().GetAccountName(Eval("UserKey")) %></td>
	                        <td class="banma22_2" style="height: 25px; text-align: center;">
	                            <asp:LinkButton ID="Update" runat="server" CommandName="update" >更新</asp:LinkButton>
	                            <asp:LinkButton ID="Cancel" runat="server" CommandName="cancel"  CausesValidation="false">取消</asp:LinkButton>
	                        </td>
	                        </EditItemTemplate>
	                  </asp:ListView>
	                   <!-- Page Begin --><asp:DataPager ID="DataPager1" runat="server" PagedControlID="lv_Stock" PageSize="20">
                                   <Fields>
                                    <asp:TemplatePagerField>
                                         <PagerTemplate>
                              
                              <table width="96%" border="0" cellpadding="0" cellspacing="0" align="center">
                                <tr>
                                    <td width="36%" height="30">
                                        页次：<b><%# WebUtility.GetCurrentPage(Container.StartRowIndex, Container.PageSize)%></b>/<b><%# WebUtility.GetTotalPage(Container.TotalRowCount, Container.PageSize)%></b>页 
                                        每页<b><%# Container.PageSize  %></b>条 共<b><%# Container.TotalRowCount %></b>条
                                    </td>
                                    <td width="64%" height="30" style="text-align: right;">
                                        分页：
                                        </PagerTemplate>
                                     </asp:TemplatePagerField>
                                     <asp:NextPreviousPagerField ButtonType="Image" FirstPageImageUrl="../images/first.gif" ShowFirstPageButton="true" ShowNextPageButton="false" ShowPreviousPageButton="false" />
                                     <asp:NumericPagerField CurrentPageLabelCssClass="SelectedPage" NumericButtonCssClass="NotSelectedPage" />
                                     <asp:NextPreviousPagerField ButtonType="Image" LastPageImageUrl="../images/last.gif"  ShowLastPageButton="true" ShowNextPageButton="false" ShowPreviousPageButton="false" />
                                     <asp:TemplatePagerField>
                                        <PagerTemplate>
                                               转到：
                                            <asp:DropDownList ID="PageList" runat="server" AutoPostBack="true" 
                                                onselectedindexchanged="PageList_SelectedIndexChanged" >
                                            </asp:DropDownList>
                                                </td>
                                            </tr>
                                        </table>
                                         </PagerTemplate>
                                     </asp:TemplatePagerField>
                                   </Fields>
                        </asp:DataPager>
                        <!-- Page End -->
        </td>
    </tr>
</table>
        </td>
   </tr>
   </table>
</asp:Content>

